Skip to content

feat(maintainer/contributors): add invite system — DB schema, send invite action, accept flow #517#614

Open
prasiddhi-105 wants to merge 2 commits into
Coder-s-OG-s:mainfrom
prasiddhi-105:feat/invite-system
Open

feat(maintainer/contributors): add invite system — DB schema, send invite action, accept flow #517#614
prasiddhi-105 wants to merge 2 commits into
Coder-s-OG-s:mainfrom
prasiddhi-105:feat/invite-system

Conversation

@prasiddhi-105

@prasiddhi-105 prasiddhi-105 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR replaces the unstructured client-side referral link mechanism (/?ref={accountLogin}) with a robust, database-tracked, email-driven structured invitation system. It introduces a complete backend management flow (send, resend, list, revoke) along with a standalone invitation landing accept page and a reactive "Pending Invites" sidebar tracking dashboard widget.

Type of Change

  • Bug fix
  • New feature
  • UI / UX improvement
  • Refactor
  • Documentation
  • Other

Related Issue

Closes #517

What was changed?

  • Database Schema Modifications: Appended the invites table tracking unique tokens, timestamps, target organization installation IDs, and statuses per invited email using Drizzle ORM dialects (src/lib/db/schema.ts).
  • Robust Server Actions Suite: Created four clean operations guarded by requireMaintainer() that securely manage invitations utilizing the project's native getDb() client instance (src/app/actions/maintainer/invites.ts):
    • sendInvite(): Validates input email formatting, checks for pre-existing active records, generates a secure random hex token, writes to the DB, and dispatches the email invitation hook.
    • resendInvite(): Renews an invitation by pushing the rolling expiration boundary out by another 7 days.
    • listPendingInvites(): Filters and fetches active, non-expired invitation rows for the given repository workspace.
    • revokeInvite(): Purges an active record from database indices cleanly.
  • Email Template Extension: Built a dedicated HTML/text transitional email template function (sendInviteEmail) wrapping the initialized resend client package (src/lib/email.ts).
  • Standalone Acceptance Router Page: Initialized src/app/invite/[token]/page.tsx as a separate, distraction-free screen outside the core dashboard shell layout. It evaluates the valid parameters, handles authentication redirection parameters cleanly via ?next=, processes multi-table records atomically inside a Drizzle .transaction(), and updates the contributor access list safely.
  • Client UI Integration: Re-engineered src/app/(app)/maintainer/invite-contributor-button.tsx to handle true form submission dispatches and appended a beautiful Pending Invites sidebar tracker grid list to view statuses, resend, or revoke actions instantly.

Screenshots

Will add screenshots upon deployment to the staging environment due to a local dev auth loop. Tested via static type checking.

Checklist

  • My code follows the project structure and conventions
  • I tested this locally (npm run dev)
  • No hardcoded secrets or credentials
  • I have updated documentation if needed

@jakharmonika364

Copy link
Copy Markdown
Collaborator

please fix the conflict, then we proceed with the review

@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

@prasiddhi-105 is attempting to deploy a commit to the codersogs-3057's projects Team on Vercel.

A member of the Team first needs to authorize it.

@prasiddhi-105

Copy link
Copy Markdown
Contributor Author

please fix the conflict, then we proceed with the review

donee

@Ayush-Patel-56

Copy link
Copy Markdown
Collaborator

CI is still failing, please run npm run typecheck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(maintainer/contributors): add invite system — DB schema, send invite action, accept flow

3 participants